package cn.elwy.rcp.ui.explorer.core.vo;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.elwy.common.util.PathUtil;

public class ProjectConfig implements Serializable {

	private static final long serialVersionUID = 1L;

	private String projectName;
	private String version;
	private String projectPath;
	private String resourcePath;
	private String outputPath;
	private String scmUrl;
	private String scmUser;
	private String scmPassword;
	private boolean testSvn;
	private boolean updateStartVersion;
	private String startVersion;
	private String endVersion;
	private String sourceDirectory;
	private String docDirectory;
	private String demoDirectory;
	private String srcDirectory;
	private String dbScriptDirectory;

	private String dbsUpdateOriginDir;
	private String dbsUpdateTargetDir;

	private String containerDirectory;
	private String parentPom;
	private String toolsPath;
	private List<String> planList;
	private FtpInfo release;
	private List<FtpInfo> deployList;
	private boolean autoUpdate;
	private boolean errorBreak;
	private String cmmonds;
	private List<BuilderModule> moduleList;
	private String outputFolder;
	private String outputDir;

	private String mvnCmd;
	private String warPath;
	private int packType;

	private Date date;

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String name) {
		this.projectName = name;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getProjectPath() {
		return projectPath;
	}

	public void setProjectPath(String projectPath) {
		this.projectPath = projectPath;
	}

	public String getResourcePath() {
		return resourcePath;
	}

	public void setResourcePath(String resourcePath) {
		this.resourcePath = resourcePath;
	}

	public String getOutputPath() {
		return outputPath;
	}

	public void setOutputPath(String outputPath) {
		this.outputPath = outputPath;
	}

	public String getScmUrl() {
		return scmUrl;
	}

	public void setScmUrl(String scmUrl) {
		this.scmUrl = scmUrl;
	}

	public String getScmUser() {
		return scmUser;
	}

	public void setScmUser(String scmUser) {
		this.scmUser = scmUser;
	}

	public String getScmPassword() {
		return scmPassword;
	}

	public void setScmPassword(String scmPassword) {
		this.scmPassword = scmPassword;
	}

	public boolean isTestSvn() {
		return testSvn;
	}

	public void setTestSvn(boolean testSvn) {
		this.testSvn = testSvn;
	}

	public boolean isUpdateStartVersion() {
		return updateStartVersion;
	}

	public void setUpdateStartVersion(boolean updateStartVersion) {
		this.updateStartVersion = updateStartVersion;
	}

	public String getStartVersion() {
		return startVersion;
	}

	public void setStartVersion(String startVersion) {
		this.startVersion = startVersion;
	}

	public String getEndVersion() {
		return endVersion;
	}

	public void setEndVersion(String endVersion) {
		this.endVersion = endVersion;
	}

	public String getSourceDirectory() {
		return sourceDirectory;
	}

	public void setSourceDirectory(String sourceDirectory) {
		this.sourceDirectory = sourceDirectory;
	}

	public String getDocDirectory() {
		return docDirectory;
	}

	public void setDocDirectory(String docDirectory) {
		this.docDirectory = docDirectory;
	}

	public String getDemoDirectory() {
		return demoDirectory;
	}

	public void setDemoDirectory(String demoDirectory) {
		this.demoDirectory = demoDirectory;
	}

	public String getSrcDirectory() {
		return srcDirectory;
	}

	public void setSrcDirectory(String srcDirectory) {
		this.srcDirectory = srcDirectory;
	}

	public String getDbScriptDirectory() {
		return dbScriptDirectory;
	}

	public void setDbScriptDirectory(String dbScriptDirectory) {
		this.dbScriptDirectory = dbScriptDirectory;
	}

	public String getContainerDirectory() {
		return containerDirectory;
	}

	public String getDbsUpdateOriginDir() {
		return dbsUpdateOriginDir;
	}

	public void setDbsUpdateOriginDir(String dbsUpdateOriginDir) {
		this.dbsUpdateOriginDir = dbsUpdateOriginDir;
	}

	public String getDbsUpdateTargetDir() {
		return dbsUpdateTargetDir;
	}

	public void setDbsUpdateTargetDir(String dbsUpdateTargetDir) {
		this.dbsUpdateTargetDir = dbsUpdateTargetDir;
	}

	public void setContainerDirectory(String containerDirectory) {
		this.containerDirectory = containerDirectory;
	}

	public String getParentPom() {
		return parentPom;
	}

	public void setParentPom(String parentPom) {
		this.parentPom = parentPom;
	}

	public String getToolsPath() {
		return toolsPath;
	}

	public void setToolsPath(String toolsPath) {
		this.toolsPath = toolsPath;
	}

	public List<String> getPlanList() {
		return planList;
	}

	public void addPlanList(String plan) {
		if (planList == null) {
			planList = new ArrayList<String>();
		}
		planList.add(plan);
	}

	public void setPlanList(List<String> planList) {
		this.planList = planList;
	}

	public FtpInfo getRelease() {
		return release;
	}

	public void setRelease(FtpInfo release) {
		this.release = release;
	}

	public List<FtpInfo> getDeployList() {
		return deployList;
	}

	public void addDeployList(FtpInfo deploy) {
		if (deployList == null) {
			deployList = new ArrayList<FtpInfo>();
		}
		deployList.add(deploy);
	}

	public void setDeployList(List<FtpInfo> deployList) {
		this.deployList = deployList;
	}

	public boolean isAutoUpdate() {
		return autoUpdate;
	}

	public void setAutoUpdate(boolean autoUpdate) {
		this.autoUpdate = autoUpdate;
	}

	public boolean isErrorBreak() {
		return errorBreak;
	}

	public void setErrorBreak(boolean errorBreak) {
		this.errorBreak = errorBreak;
	}

	public String getCmmonds() {
		return cmmonds;
	}

	public void setCmmonds(String cmmonds) {
		this.cmmonds = cmmonds;
	}

	public List<BuilderModule> getModuleList() {
		return moduleList;
	}

	public void setModuleList(List<BuilderModule> moduleList) {
		this.moduleList = moduleList;
	}

	public Date getDate() {
		if (date == null) {
			date = new Date();
		}
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getOutputFolder() {
		if (outputFolder == null) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
			String createTime = sdf.format(getDate());
			outputFolder = projectName + "-" + version + "-" + createTime;
		}
		return outputFolder;
	}

	public void setOutputFolder(String outputFolder) {
		this.outputFolder = outputFolder;
	}

	public String getOutputDir() {
		if (outputDir == null) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
			String createTime = sdf.format(getDate());
			outputDir = projectName + "-" + version + "-" + createTime;
			outputDir = PathUtil.getFilePath(outputPath, outputDir);
		}
		return outputDir;
	}

	public void setOutputDir(String outputDir) {
		this.outputDir = outputDir;
	}

	public String getMvnCmd() {
		return mvnCmd;
	}

	public void setMvnCmd(String mvnCmd) {
		this.mvnCmd = mvnCmd;
	}

	public String getWarPath() {
		return warPath;
	}

	public void setWarPath(String warPath) {
		this.warPath = warPath;
	}

	public int getPackType() {
		return packType;
	}

	public void setPackType(int packType) {
		this.packType = packType;
	}

	// public boolean isPackTypeWar(){
	// return packType == ProjectConst.PACK_TYPE_WAR;
	// }
	//
	// public boolean isPackTypeIncrementWar(){
	// return packType == ProjectConst.PACK_TYPE_INCREMENT_WAR;
	// }
	// public boolean isPackTypeJar(){
	// return packType == ProjectConst.PACK_TYPE_JAR;
	// }
}
